#ifndef _WX_COLOUR_H_BASE_
#define _WX_COLOUR_H_BASE_

#include "wx/defs.h"
#include "wx/gdiobj.h"

class wxColour;

#define wxC2S_NAME              1
#define wxC2S_CSS_SYNTAX        2
#define wxC2S_HTML_SYNTAX       4

const unsigned char wxALPHA_TRANSPARENT = 0;
const unsigned char wxALPHA_OPAQUE = 0xff;

#if wxUSE_VARIANT
#include "wx/variant.h"
DECLARE_VARIANT_OBJECT_EXPORTED( wxColour )
#endif

class wxColourBase : public wxGDIObject {
  public:
    typedef unsigned char ChannelType;
    wxColourBase() {}
    virtual ~wxColourBase() {}
    void Set( ChannelType red, ChannelType green,ChannelType blue,
              ChannelType alpha = wxALPHA_OPAQUE ) { InitRGBA( red, green, blue, alpha ); }
    bool Set( const wxChar *str ) { return FromString( str ); }
    bool Set( const wxString &str ) { return FromString( str ); }
    void Set( unsigned long colRGB ) {
      Set( ( ChannelType )( 0xFF & colRGB ),( ChannelType )( 0xFF & ( colRGB >> 8 ) ),
           ( ChannelType )( 0xFF & ( colRGB >> 16 ) ) );
    }

    virtual bool Ok() const { return IsOk(); }
    virtual bool IsOk() const = 0;
    virtual ChannelType Red() const = 0;
    virtual ChannelType Green() const = 0;
    virtual ChannelType Blue() const = 0;
    virtual ChannelType Alpha() const { return wxALPHA_OPAQUE ; }
    virtual wxString GetAsString( long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX ) const;
    wxDEPRECATED( static wxColour CreateByName( const wxString& name ) );
    wxDEPRECATED( void InitFromName( const wxString& col ) );

  protected:
    virtual void
    InitRGBA( ChannelType r, ChannelType g, ChannelType b, ChannelType a ) = 0;

    virtual bool FromString( const wxChar *s );
};

class wxColour : public wxColourBase {
  public:
    wxColour() {}
    wxColour( ChannelType red, ChannelType green, ChannelType blue, ChannelType alpha = wxALPHA_OPAQUE ) {
      Set( red, green, blue, alpha );
    }
    wxColour( unsigned long colRGB ) { Set( colRGB ); }
    wxColour( const wxString &colourName ) { Set( colourName ); }
    wxColour( const wxChar *colourName ) { Set( colourName ); }
    wxColour( const GdkColor& gdkColor );
    virtual ~wxColour();
    bool Ok() const { return IsOk(); }
    bool IsOk() const { return m_refData != NULL; }
    bool operator == ( const wxColour& col ) const;
    bool operator != ( const wxColour& col ) const { return !( *this == col ); }
    unsigned char Red() const;
    unsigned char Green() const;
    unsigned char Blue() const;
    unsigned char Alpha() const;
    void CalcPixel( GdkColormap *cmap );
    int GetPixel() const;
    const GdkColor *GetColor() const;
  protected:
    virtual void InitRGBA( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
    virtual bool FromString( const wxChar *str );
  private:
  public:
    static wxClassInfo ms_classInfo;
    virtual wxClassInfo *GetClassInfo() const;
    static wxObject* wxCreateObject();

};
#define wxColor wxColour

#endif
